package java6681.oursplit;

import java.util.Arrays;

public class OurSplit6681Test {
    static OurSplit6681 spit = new OurSplit6681();

    public static void main(String[] args) {
        String[] inputs1 = {",,前面的逗号,,,连续的逗号,分隔,,,后面的逗号,,",",a ,,bbb,,,cccc,"
                ,"this,java","abc"};
        String[][] expects1 = {{"前面的逗号","连续的逗号","分隔", "后面的逗号"},{"a ","bbb","cccc"},
                {"this","java"},{"abc"}};
        System.out.println("分隔符:"+spit.getSeparator());
        unit(inputs1,expects1);
        spit.setSeparator('a');
        String[] inputs2 = {"aaa前面的逗号aa连续的逗号a分隔aaa后面的逗号aaa","athisaaaaajava","abc"};
        String[][] expects2 = {{"前面的逗号", "连续的逗号", "分隔", "后面的逗号"},
                {"this","java"},{"abc"}};
        System.out.println("分隔符:"+ spit.getSeparator());
        unit(inputs2,expects2);

//        int testNum = 9;
//        String[] arr = {"1234", "123456", "", "     ", "123a465s", "1245E2AS",
//                "QWEASzxc", " 51sd sadAS  ", "123QWEzxc12"};
//
//        String[] arr1 = {"false", "false", "false", "false", "false", "false",
//                "false", "false", "true", "false"};
//
//        for (int i = 0; i < testNum; i++) {
//            boolean b;
//            System.out.println("测试用例编号：" + i);
//            System.out.println("输入:" + arr[i]);
//            System.out.print("预期结果:" + arr1[i]);
//            System.out.println("实际运行结果:");
//            System.out.println("");
//     }
    }

    private static void unit(String[] inputs, String[][] expects) {
        for (int i = 0; i < inputs.length; i++) {
            String[] words = spit.split(inputs[i]);
            System.out.println(i+1+":输入:\""+inputs[i]+"\"");
            System.out.println("实际运行结果："+(Arrays.toString(words)));
            if (Arrays.equals(expects[i],words)){
                System.out.println("通过");
            }else{
                System.out.println("未通过");
            }
            System.out.println();
        }
    }

}
